//
//  ChannelPage_Model.m
//  STL_ Animation
//
//  Created by 孙健 on 16/4/5.
//  Copyright © 2016年 STL. All rights reserved.
//

#import "ChannelPage_Model.h"

@implementation ChannelPage_Model

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
    if ([key isEqualToString:@"id"]) {
        
        self.idName = value;
    }
    
    if ([key isEqualToString:@"description"]) {
        
        self.descriptionName = value;
    }
}

- (instancetype)initWithDataSource:(NSDictionary *)dataSource {
    
    self = [super initWithDataSource:dataSource];
    if (self) {
        [self setValuesForKeysWithDictionary:dataSource];
        NSMutableArray *array = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in self.artists) {
          
            ChannelPage_artistModel *artistModel = [[ChannelPage_artistModel alloc] init];
            [artistModel setValuesForKeysWithDictionary:dic];
            [array addObject:artistModel];
        }
        
        self.artists = [NSMutableArray arrayWithArray:array];
        
        NSMutableArray *arrayNew = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in self.relatedVideos) {
            
            ChannelPage_Model *channelModel = [[ChannelPage_Model alloc] init];
            [channelModel setValuesForKeysWithDictionary:dic];
            [arrayNew addObject:channelModel];
        }
        
        self.relatedVideos = [NSMutableArray arrayWithArray:arrayNew];
        
    }
    
    return self;
}

@end
